package xyz.cerberu.cet.global.domain;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * @author β世界
 * Created on 16:20
 * @Description 全局的设置
 */
@Component
@ConfigurationProperties(prefix = "global")
public class Global {

    /**
     * 特殊动漫更新配置文件
     **/
    private File specialAnime;

    /**
     * 图片文件所要存放的位置
     * 默认位置为 {Tomcat安装目录}/bin/cover
     **/
    private File imgFolderPath = new File("cover");

    /**
     * 错误图片的默认显示
     **/
    private File errorImg;

    /**
     * 日志等级
     **/
    private int logLevel;

    /**
     * 分页时一页的显示数量
     **/
    private int pageShowNumber;

    /**
     * 评论显示的分页数
     **/
    private int commentShowNumber;

    /**
     * 在动漫管理的页面中，允许被修改的字段
     **/
    private String[] animeReleaseField;

    /***
     * 用于设置搜索服务的实现类型
     **/
    private String searchLiving;

    /**
     * solr服务的url
     **/
    private String solrUrl;

    /**
     * 用于存储图片文件的文件夹
     **/
    private String pictureFolder;

    /**
     * 记住用户的最长时间
     **/
    private int rememberMeMaxAge;

    /**
     * 记住用户的cookie名字
     **/
    private String rememberMeCookieName = "rememberMe";

    public Global() {
    }

    public Global(File imgFolderPath, File errorImg) {
        this.imgFolderPath = imgFolderPath;
        this.errorImg = errorImg;
    }

    public File getSpecialAnime() {
        return specialAnime;
    }

    public void setSpecialAnime(File specialAnime) {
        this.specialAnime = specialAnime;
    }

    public void setErrorImg(File errorImg) {
        this.errorImg = errorImg;
    }

    public void setImgFolderPath(File imgFolderPath) {
        this.imgFolderPath = imgFolderPath;
    }

    public File getErrorImg() {
        return errorImg;
    }

    public File getImgFolderPath() {
        return imgFolderPath;
    }

    public int getPageShowNumber() {
        return pageShowNumber;
    }

    public void setPageShowNumber(int pageShowNumber) {
        this.pageShowNumber = pageShowNumber;
    }

    public int getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(int logLevel) {
        this.logLevel = logLevel;
    }

    public int getCommentShowNumber() {
        return commentShowNumber;
    }

    public void setCommentShowNumber(int commentShowNumber) {
        this.commentShowNumber = commentShowNumber;
    }

    public String[] getAnimeReleaseField() {
        return animeReleaseField;
    }

    public void setAnimeReleaseField(String animeReleaseField) {
        this.animeReleaseField = animeReleaseField.split(",");
    }

    public String getSearchLiving() {
        return searchLiving;
    }

    public void setSearchLiving(String searchLiving) {
        this.searchLiving = searchLiving;
    }

    public String getSolrUrl() {
        return solrUrl;
    }

    public void setSolrUrl(String solrUrl) {
        this.solrUrl = solrUrl;
    }

    public String getPictureFolder() {
        return pictureFolder;
    }

    public void setPictureFolder(String pictureFolder) {
        this.pictureFolder = pictureFolder;
    }

    public int getRememberMeMaxAge() {
        return rememberMeMaxAge;
    }

    public void setRememberMeMaxAge(int rememberMeMaxAge) {
        this.rememberMeMaxAge = rememberMeMaxAge;
    }

    public String getRememberMeCookieName() {
        return rememberMeCookieName;
    }

    public void setRememberMeCookieName(String rememberMeCookieName) {
        this.rememberMeCookieName = rememberMeCookieName;
    }
}
